function promote_player(player_id)
{
	modal.html(get_loading_img()).show();
	$.post("/ajax/players_move.ajax.php",{"player_id":player_id,"move":"up"},function(data){
		if(data != null)
		{
			if(data["error"] == "")
			{
				player_set_reserves(player_id,false);
				modal.html("<h2>"+bteam_content[57]+"</h2><p><strong class='large'>"+data["player_name"]+"</strong> "+bteam_content[58]+"</p>"
				+"<div class='msgbuttons'>"+make_button(global_content["ok"],"modal.hide()")+"</div>");
			}
			else
			{
				modal.html("<h2>"+bteam_content[57]+"</h2>"
				+"<p>"+data["error"]+"</p>"
				+"<div class='msgbuttons'>"+make_button(global_content["ok"],"modal.hide()")+"</div>");
			}
		}
	},"json");
}
function demote_player(player_id,confirm)
{
	confirm = confirm || false;
	if(confirm)
	{
		modal.transition(get_loading_img(),function(){
			$.post("/ajax/players_move.ajax.php",{"player_id":player_id,"move":"down"},function(data){
				if(data != null)
				{
					if(data["success"])
					{
						player_set_reserves(player_id,true);
						modal.html("<h2>"+bteam_content[60]+"</h2><p><strong class='large'>"+data["player_name"]+"</strong> "+bteam_content[61]+"</p>"
							+"<div class='msgbuttons'>"+make_button(global_content["ok"],"modal.hide()")+"</div>");
					}
					else
					{
						var error = data["error"].replace(/\[player\]/g,"<strong class='large'>"+data["player_name"]+"</strong>");
						modal.html("<h2>"+bteam_content[60]+"</h2>"
							+"<p>"+error+"</p>"
							+"<div class='msgbuttons'>"+make_button(global_content["ok"],"modal.hide()")+"</div>");
					}
				}
			},"json");
		});
	}
	else
	{
		modal.html(get_loading_img()).show();
		if (days_to_bteam_expiry>=0)
		{
			$.post("/ajax/players_move.ajax.php",{"player_id":player_id,"move":"check"},function(data){
				if(data != null)
				{
					var html ="<h2>"+bteam_content[60]+"</h2>";
					if(data["error"] == "")
					{
						html += "<p>"+bteam_content[62]+" <strong class='large'>"+data["player_name"]+"</strong>?</p>"
						+"<p>"+bteam_content[63]+"</p>"
						+"<div class='msgbuttons'>"+make_button(""+bteam_content[59]+"","demote_player("+player_id+",true)")+" "+make_button(global_content["cancel"],"modal.hide()")+"</div>";
					}
					else
					{
						var error = data["error"].replace(/\[player\]/g,"<strong class='large'>"+data["player_name"]+"</strong>");
						html += "<p>"+error+"</p>"
						+"<div class='msgbuttons'>"+make_button(global_content["ok"],"modal.hide()")+"</div>";
					}
					modal.html(html);
				}
			},"json");
		}
		else
		{
			var html ="<h2>"+bteam_content[56]+"</h2>";
			html += "<p>"+pc_replace(global_content["reserve_renew"], {"[days]":days_to_bteam_expiry, "[link]":"<a href='/account/reserve-teams/'>", "[/link]":"</a>"})+"</p>"
			modal.html(html);
		}
	}
}
